-
Notifications
You must be signed in to change notification settings - Fork 103
Fix: Unable to Hang Up/Reject Call during Ringing State (Null callSid) #309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sajanIocod
wants to merge
30
commits into
cybex-dev:master
Choose a base branch
from
bazl-E:sb/twilio-call-fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+817
−244
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Preserve the device token for VoIP push notifications to avoid the need for users to restart the app to obtain a new device token. Removing the device token from UserDefaults caused registration failures.
fix : IOS not displaying caller number
if the user doesn't set a default caller name it will display the incoming caller number , if the already set a value user has to call [await TwilioVoice.instance.setDefaultCallerName('');] to make this work
Update the handling of the localized caller name in the `SwiftTwilioVoicePlugin.swift` file. Instead of using the `clients` dictionary to retrieve the caller name, always use the `formatUSPhoneNumber` function to format the caller's phone number. This ensures consistency and avoids potential issues with missing or incorrect caller names. Note: This commit message follows the established convention of starting with a verb in the imperative form, followed by a concise description of the changes made.
…ter to place method
# Conflicts: # android/build.gradle # android/src/main/kotlin/com/twilio/twilio_voice/TwilioVoicePlugin.kt # android/src/main/kotlin/com/twilio/twilio_voice/service/TVConnectionService.kt # android/src/main/kotlin/com/twilio/twilio_voice/types/TVMethodChannels.kt # example/ios/Runner.xcodeproj/project.pbxproj # ios/Classes/SwiftTwilioVoicePlugin.swift # ios/twilio_voice.podspec # lib/_internal/twilio_voice_web.dart
…ove phone account settings handling
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of Change
[x] Bug fix (non-breaking change which fixes an issue)
Description
This PR addresses a critical issue where attempting to hang up or reject an incoming call while it is in the Ringing state would fail and log the error: ACTION_HANGUP is missing String EXTRA_CALL_HANDLE.
🔍 detailed Breakdown
Previous Scenario (The Bug)
Previously, the callSid variable in TwilioVoicePlugin was implemented as a computed property that queried the service directly every time it was accessed:
// Old Implementation
private val callSid: String?
get() = TVConnectionService.getActiveCallHandle()
The Issue: When a call is in the Ringing/Incoming state, the TVConnectionService often does not yet classify the call as "Active." Therefore, getActiveCallHandle() returns null. Consequently, when the user pressed "Hangup," the plugin sent an Intent with a null handle. The Service received the intent, couldn't identify which call to kill, and threw the error.
New Scenario (The Fix)
The implementation of callSid has been refactored to use local state management within the plugin.
// New Implementation
private var callSid: String? = null
The Logic:
Capture: The plugin now listens for ACTION_INCOMING_CALL (and other lifecycle events) in handleBroadcastIntent.
Store: It immediately extracts the callHandle from the broadcast intent and saves it to the local callSid variable.
Execute: When hangup() is called during the Ringing state, the plugin reads the locally stored, valid ID.
Cleanup: The callSid is reset to null upon receiving Disconnect, Reject, or Abort events.
Technical Changes
Refactored callSid from a getter to a nullable String variable.
Updated handleBroadcastIntent to set callSid on:
ACTION_INCOMING_CALL
ACTION_ANSWERED
EVENT_RINGING
EVENT_CONNECTED
Updated handleBroadcastIntent to clear callSid (set to null) on:
ACTION_CALL_ENDED
ACTION_REJECTED
ACTION_ABORT
EVENT_DISCONNECTED (Local/Remote)
EVENT_MISSED
Updated TVMethodChannels.CALL_SID to return the local variable.